<%@ page import="beans.DBHelper" language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet"
	href="http://cdn.bootcss.com/bootstrap/3.2.0/css/bootstrap.min.css">
<title>Job Search</title>
<style type="text/css">
.errorinfo{
	color: #FF0000;
	display: none;
}


table{
	width:20px;
}

table td, table th {
	padding-bottom: 10px;
	padding-left: 10px;
	padding-right: 10px;
	padding-top: 10px;
}

#btn1{
	width:150px;
	margin-left:100px;
}
#btn2{
	margin-left:100px;
	width:150px;
}



</style>

<script type="text/javascript">

function checkCompany(value) {
	var regex= /^\w{1,}$/;
	if(regex.test(value))
	{
		companydiv.innerHTML = "<div style=\"color:red\">"+""+"</ div>";
		return true;
	}
	else
	{
		companydiv.innerHTML = "<div style=\"color:red\">"+"*Please Input"+"</ div>";
		return false;
	}
	
}
function checkSalary(value) {
	var regex= /^\d{1,}\.?\d{0,}$/;
	if(regex.test(value))
	{
		salarydiv.innerHTML = "<div style=\"color:red\">"+""+"</ div>";
		return true;
	}
	else
	{
		salarydiv.innerHTML = "<div style=\"color:red\">"+"*Please Input Number"+"</ div>";
		return false;
	}
}

function checkAddress(value){
	if(value==99)
	{
		addressdiv.innerHTML = "<div style=\"color:red\">"+"*Please select"+"</ div>";
		return false;
	}
	else
	{
		addressdiv.innerHTML = "<div style=\"color:red\">"+""+"</ div>";
		return true;
	}
}


function checkCompanyType(value){
	if(value==99)
	{
		companytypediv.innerHTML = "<div style=\"color:red\">"+"*Please select"+"</ div>";
		return false;
	}
	else
	{
		companytypediv.innerHTML = "<div style=\"color:red\">"+""+"</ div>";
		return true;
	}
}
function checkJobtype(value){
	if(value==99)
	{
		jobtypediv.innerHTML = "<div style=\"color:red\">"+"*Please select"+"</ div>";
		return false;
	}
	else
	{
		jobtypediv.innerHTML = "<div style=\"color:red\">"+""+"</ div>";
		return true;
	}
}

function checkCompanysize(value){
	var regex= /^\d{1,}$/;
	if(regex.test(value))
	{
		companysizediv.innerHTML = "<div style=\"color:red\">"+""+"</ div>";
		return true;
	}
	else
	{
		companysizediv.innerHTML = "<div style=\"color:red\">"+"*Please Input Number"+"</ div>";
		return false;
	}
}
function checkForm(formNode) {
	with(formNode){
		if(checkCompany(company.value)&checkSalary(salary.value)&checkAddress(address.value)&checkCompanysize(companysize.value)&checkCompanyType(companytype.value)&checkJobtype(jobtype.value))
			return true;
		else
			return false;
	}
}
function clean()
{
	companydiv.innerHTML = "<div style=\"color:red\">"+""+"</ div>";
	salarydiv.innerHTML = "<div style=\"color:red\">"+""+"</ div>";
	addressdiv.innerHTML = "<div style=\"color:red\">"+""+"</ div>";
	companytypediv.innerHTML = "<div style=\"color:red\""+""+"</div>";
	companysizediv.innerHTML = "<div style=\"color:red\">"+""+"</ div>";
	jobtypediv.innerHTML = "<div style=\"color:red\">"+""+"</ div>";
}

</script>
</head>
<body>

<form action="ProvideJob" method="post" name="pjob" onsubmit="return checkForm(this)">

<%String provider="employer"; %>
<table class="table" align="center" id="protable" style="margin-left:40px">

<tr>
    <th colspan="3">
    <h2>Job Information</h2>
    </th>
</tr>
<tr>
    <td width="300" >company: </td>
    <td width="300" >
    <div><input type="text" name="company"onblur="checkCompany(this.value)"></div>
    </td width="300">
    <td  style="word-wrap:break-word;" >
    <div id="companydiv" ></div>
    </td>  
</tr>
<tr>
    <td >salary:</td>
    <td><div> <input type="text" name="salary"onblur="checkSalary(this.value)"></div></td>
    <td>
    <div id="salarydiv"></div>
    </td>
</tr>
<tr>
   <td >address:</td>
    <td><select  name="address" onchange=checkAddress(this.value)  style="width:58%">
    		<option value="99"  selected  >--Please Select--</option>
			<option value="jiangsu"  >jiangsu</option><option value="shanghai"  >shanghai</option>
			<option value="zhejiang"  >zhejiang</option><option value="anhui"  >anhui</option>
			<option value="fujian"  >fujian</option><option value="henan"  >henan</option>
			<option value="beijing"  >beijing</option><option value="hubei"  >hubei</option>
			<option value="tianjin"  >tianjin</option><option value="shandong"  >shandong</option>
			<option value="guangdong"  >guangdong</option><option value="hebei"  >hebei</option>
			<option value="Others"  >Others</option></select></td>
    <td>
    <div id="addressdiv"></div>
    </td>
</tr>
<tr>
    <td >companySize:</td>
    <td><div> <input type="text" name="companysize"onblur="checkCompanysize(this.value)"></div></td>
    <td>
    <div id="companysizediv"></div>
    </td>
</tr>
<tr>
    <td >companyType:</td>
    <td><select  name="companytype" onchange=checkCompanyType(this.value)  style="width:58%" >
    		<option value="99"  selected  >--Please Select--</option>
			<option value="Foreign"  >Foreign(外资)</option><option value="Joint-ventured"  > Joint-ventured(合资)</option>
			<option value="SOEs"  >SOEs(国企)</option><option value="Private-company"  >Private-company(民营公司)</option>
			<option value="Others"  >Others</option></select></td>
    <td>
    <div id="companytypediv"></div>
    </td>
</tr>
<tr>
   <td >jobType:</td>
    <td><select  name="jobtype" onchange=checkJobtype(this.value)  style="width:58%" >
    		<option value="99"  selected  >--Please Select--</option>
			<option value="Computer"  >Computer(计算机)</option><option value="Financial"  >Financial(金融)</option>
			<option value="Trade"  >Trade(贸易)</option><option value="Advertising"  >Advertising(广告)</option>
			<option value="Logistics-Department"  >Logistics-Department(物流)</option><option value="Others"  >Others</option>
			</select></td>
    <td>
    <div id="jobtypediv"></div>
    </td>
</tr>
<tr>
    <td colspan="3"><input class="btn btn-primary" type="submit" value="ADD" id="btn1">
    <input class="btn btn-primary" type="reset" value="Clean" id="btn2" onclick="clean()">
    </td>
</tr>
</table>
</form>
</body>
</html>